package com.codeshellme.bookmanager.dao;

import com.codeshellme.bookmanager.dto.BookStock;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface BookStockDao {

    List<Map<String, Object>> queryAllBookStocks(String name, Integer type_id, Integer num_start, Integer num_end,
                                                 Integer author_id, Byte status, String date_start, String date_end,
                                                 String q);

    Map<String, Object> findBookStockByName(String bookName);

    int addBookStock(BookStock stock);

    int updateBookStockNum(Integer id, Integer num);

    /**
     * 删除库存
     * @param id 库存 id
     * @return 1 成功
     *         0 还有库存不能删除
     */
    int deleteBookStockById(Integer id);
}
